import { NCAPIStructure } from "../../frame/native/NativeClient";

export type GNCRequest<uri extends GNCAPIURI> = GNCAPIStructMap[uri]['request'];
export type GNCResponse<uri extends GNCAPIURI> = GNCAPIStructMap[uri]['response'];
export type GNCBody<uri extends GNCAPIURI> = GNCRequest<uri>['data'];
export type GNCResult<uri extends GNCAPIURI> = Awaited<GNCResponse<uri>>['data'];

export enum GNCAPIURI {
	/** 设备ID */
	DeviceID = 'device_id',
	/** 设置剪贴板 */
	SetClipboard = 'set_clipboard',
	/** 广告接口 */
	AD = 'AD',
	/** 本地化接口 */
	LOCAL = 'LocalLanguage',
	/** 浮层弹窗 */
	Float = 'float-pop',
	/** 评分弹窗 */
	ScorePop = 'ScorePop',
	/** 关闭加载中 */
	CloseLoading = 'closeLoading',
	/** 游戏内容切换 */
	GameType = 'type',
	/** 埋点上报接口 */
	Point = 'POINT',
}

interface GNCAPIStructMap {
	[GNCAPIURI.SetClipboard]: NCAPIStructure<{
		/** 要设置的文本 */
		text: string;
	},{}>;
	[GNCAPIURI.AD]: NCAPIStructure<{
		/**
		 * 广告类型\
		 *  [incentive]: 激励广告\
		 *  [full-screen]: 全屏广告
		 */
		type: 'incentive'|'full-screen',
	},{
		/**
		 * 广告结束状态\
		 *  [ad-over]: 广告播放结束\
		 *  [ad-error]: 广告播放失败
		 */
		status: `ad-${'over'|'error'}`
	}>;
	[GNCAPIURI.DeviceID]: NCAPIStructure<{},{
        /** 用户设备ID */
		device_id: string;
	}>;
	[GNCAPIURI.LOCAL]: NCAPIStructure<{},{
		/**
		 * 国家码
		 *  https://q178jmgy9tl.feishu.cn/sheets/MaWdsru9ihFVVZtb7LCcGjy6nef
		 */
		countryCode: string;
		/** 语言码 */
		languageCode: string;
	}>;
	[GNCAPIURI.Float]: NCAPIStructure<{}, {}>;
	[GNCAPIURI.ScorePop]: NCAPIStructure<{}, {}>;
	[GNCAPIURI.CloseLoading]: NCAPIStructure<{}, {}>;
	[GNCAPIURI.Point]: NCAPIStructure<{
		/** 点位标识符 */
		point: string;
		/** 点位数据，格式化的字符串 */
		value: string;
	}, {}>;
	[GNCAPIURI.GameType]: NCAPIStructure<{},{
		/**
		* 展示游戏类型
		*  [A]: A面纯游戏内容
		*  [B]: B面完整的商业化内容
		*/
		type: "A"|"B";
	}>;
}
